/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2011 All Rights Reserved.
 */
package com.alipay.supergw.common.dal.share_supergw.auto.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.alipay.supergw.common.dal.share_supergw.auto.daointerface.TranstypeConfigDAO;
import com.alipay.supergw.common.dal.share_supergw.auto.dataobject.TranstypeConfigDO;

/**
 * An ibatis based implementation of dao interface <tt>com.alipay.supergw.common.dal.share_supergw.auto.daointerface.TranstypeConfigDAO</tt>.
 *
 * This file is generated by <tt>supergw-dalgen</tt>, a DAL (Data Access Layer)
 * code generation utility specially developed for <tt>supergw</tt> project.
 * 
 * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may
 * be OVERWRITTEN by someone else. To modify the file, you should go to 
 * directory <tt>(project-home)/dalgen</tt>, and 
 * find the corresponding configuration file (<tt>tables/sgw_transtype_config.xml</tt>). 
 * Modify the configuration file according to your needs, then run <tt>supergw-dalgen</tt> 
 * to generate this file.
 */
public class IbatisTranstypeConfigDAO extends SqlMapClientDaoSupport implements TranstypeConfigDAO {

    /**
     *  Query DB table <tt>sgw_transtype_config</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select trans_type_id, param_name, param_value, memo, gmt_create, gmt_modified from sgw_transtype_config</tt>
     *
     *	@return List<TranstypeConfigDO>
     *	@throws DataAccessException
     */
    @SuppressWarnings("unchecked")
    public List<TranstypeConfigDO> loadAll() throws DataAccessException {

        return getSqlMapClientTemplate().queryForList("MS-TRANSTYPE-CONFIG-LOAD-ALL", null);

    }

    /**
     *  Query DB table <tt>sgw_transtype_config</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select trans_type_id, param_name, param_value, memo, gmt_create, gmt_modified from sgw_transtype_config where ((trans_type_id = ?) AND (param_name = ?))</tt>
     *
     *	@param transTypeId
     *	@param paramName
     *	@return List<TranstypeConfigDO>
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public List<TranstypeConfigDO> select(String transTypeId, String paramName)
                                                                               throws DataAccessException {
        Map param = new HashMap();

        param.put("transTypeId", transTypeId);
        param.put("paramName", paramName);

        return getSqlMapClientTemplate().queryForList("MS-TRANSTYPE-CONFIG-SELECT", param);

    }

    /**
     *  Query DB table <tt>sgw_transtype_config</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select trans_type_id, param_name, param_value, memo, gmt_create, gmt_modified from sgw_transtype_config where ((trans_type_id = ?) AND (param_name = ?))</tt>
     *
     *	@param transTypeId
     *	@param paramName
     *	@return TranstypeConfigDO
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public TranstypeConfigDO selectByTranstypeAndParamName(String transTypeId, String paramName)
                                                                                                throws DataAccessException {
        Map param = new HashMap();

        param.put("transTypeId", transTypeId);
        param.put("paramName", paramName);

        return (TranstypeConfigDO) getSqlMapClientTemplate().queryForObject(
            "MS-TRANSTYPE-CONFIG-SELECT-BY-TRANSTYPE-AND-PARAM-NAME", param);

    }

    /**
     *  Insert one <tt>TranstypeConfigDO</tt> object to DB table <tt>sgw_transtype_config</tt>, return primary key
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>insert into sgw_transtype_config(trans_type_id,param_name,param_value,memo,gmt_create,gmt_modified) values (?, ?, ?, ?, sysdate, sysdate)</tt>
     *
     *	@param transtypeConfig
     *	@return String
     *	@throws DataAccessException
     */
    public String insert(TranstypeConfigDO transtypeConfig) throws DataAccessException {
        if (transtypeConfig == null) {
            throw new IllegalArgumentException("Can't insert a null data object into db.");
        }

        getSqlMapClientTemplate().insert("MS-TRANSTYPE-CONFIG-INSERT", transtypeConfig);

        return transtypeConfig.getParamName();
    }

    /**
     *  Update DB table <tt>sgw_transtype_config</tt>.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>update sgw_transtype_config set param_value=?, memo=?, gmt_modified=sysdate where ((trans_type_id = ?) AND (param_name = ?))</tt>
     *
     *	@param paramValue
     *	@param memo
     *	@param transTypeId
     *	@param paramName
     *	@return int
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public int update(String paramValue, String memo, String transTypeId, String paramName)
                                                                                           throws DataAccessException {
        Map param = new HashMap();

        param.put("paramValue", paramValue);
        param.put("memo", memo);
        param.put("transTypeId", transTypeId);
        param.put("paramName", paramName);

        return getSqlMapClientTemplate().update("MS-TRANSTYPE-CONFIG-UPDATE", param);
    }

    /**
     *  Delete records from DB table <tt>sgw_transtype_config</tt>.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>delete from sgw_transtype_config where ((trans_type_id = ?) AND (param_name = ?))</tt>
     *
     *	@param transTypeId
     *	@param paramName
     *	@return int
     *	@throws DataAccessException
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public int delete(String transTypeId, String paramName) throws DataAccessException {
        Map param = new HashMap();

        param.put("transTypeId", transTypeId);
        param.put("paramName", paramName);

        return getSqlMapClientTemplate().delete("MS-TRANSTYPE-CONFIG-DELETE", param);
    }

}